<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>新增预约</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="robots" content="noindex,nofollow" />
		<link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
		<link rel="stylesheet" href="__CSS__/common.css" media="all">
		<style>
			ul.layui-tab-title li::after {
			  display: none;
			}

			ul.layui-tab-title li a::after {
			  left: 20px !important;
			}
			
		</style>
	</head>

	<body class="page-body">
		<h2 class="comm-title">新增预约</h2>
		<div class="layui-tab">
			<ul class="layui-tab-title page-tab-title">
				<li><a href="{:url('index')}">预约列表</a></li>
				<li class="layui-this"><a href="javascript:;">新增</a></li>
			</ul>
		</div>
		<div class="tpcms-body-div page-main">
			<form class="layui-form" id="admin">
				<div class="layui-form-item">
				    <label class="layui-form-label">预约类型</label>
				    <div class="layui-input-block">
				      <input type="radio" name="is_grade" value="0" title="预约项目" checked="">
				      <input type="radio" name="is_grade" value="1" title="确定立项">
				    </div>
				  </div>
				<div class="layui-form-item">
					<label class="layui-form-label">选择账号</label>
					<div class="layui-input-block">
						<select name="user_id" lay-verify="required" lay-search="">
							<option value="">搜索选择</option>
							{volist name='$user' id='co' key='k'}
								<option value="{$co.id}" >【{$co.username}】{$co.mobile}</option>
							{/volist}
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">客户名称</label>
					<div class="layui-input-block">
						<input type="text" name="username"  lay-verify="required" placeholder="请输入名称" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">手机号</label>
					<div class="layui-input-block">
						<input type="text" name="mobile"  lay-verify="required" placeholder="请输入手机号" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">地址</label>
					<div class="layui-input-block">
						<input type="text" name="address"  lay-verify="required" placeholder="请输入地址" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item" pane="">
				    <label class="layui-form-label">项目</label>
				    <div class="layui-input-block">
						{volist name='$xiang' id='co' key='k'}
							<input type="checkbox" name="item_ids[]" value="{$co.id}"  lay-skin="primary" title="{$co.name}" >
						{/volist}
				    </div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">备注</label>
					<div class="layui-input-block">
						<input type="text" name="remark" lay-verify="required" placeholder="请输入备注" class="layui-input">
					</div>
				</div>



				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="button" class="layui-btn new-btn-style" lay-submit lay-filter="admin">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary default-btn">重置</button>
					</div>
				</div>

			</form>


			<script src="__PUBLIC__/layui/layui.js"></script>
			<script src="__PUBLIC__/jquery/jquery.min.js"></script>

			<script>
				layui.use(['layer', 'form', 'layedit', 'upload'], function() {
					var layer = layui.layer,
						$ = layui.jquery,
						form = layui.form;
					
					
					form.on('submit(admin)', function(data) {
						$.ajax({
							url: "{:url('add')}",
							data: $('#admin').serialize(),
							type: 'post',
							success: function(res) {
								if (res.code == 0) {
									layer.msg(res.message, {
										offset: '15px',
										icon: 1,
										time: 1000
									}, function() {
										window.location.href = "{:url('index')}";
									});
								} else {
									layer.msg(res.message, {
										offset: '15px',
										icon: 2,
										time: 1000
									});
								}
							}
						})
						return false;
					});
				});
			</script>
		</div>
	</body>

</html>
